package com.glhtgyxy.biyesheji.Mapper;

import com.glhtgyxy.biyesheji.Pojo.evaluate;
import com.glhtgyxy.biyesheji.Pojo.house;
import com.glhtgyxy.biyesheji.Pojo.user;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

@Mapper
public interface evaluateMapper {

    @Select("select * from evaluate")
    ArrayList<evaluate> findAllEvaluateMerchant();

    @Delete("delete from evaluate where id = #{id}")
    int deleteMerchant(@Param("id") int id);

    @Update("update evaluate set star=#{star} , evaluate=#{evaluate} where id = #{id}")
    int updateMerchantEva(@Param("id") int id, @Param("star") int star,
                        @Param("evaluate") String evaluate);


    @Insert("insert into evaluate (userid,merchantid,star,evaluate) values (#{userid},#{merchantid},#{star},#{evaluate})")
    int addEvaluate(int userid,
                    int merchantid,
                    int star,
                    String  evaluate
                   );


    @Select("SELECT * FROM evaluate WHERE id LIKE CONCAT('%', #{searchtext}, '%') OR userid LIKE CONCAT('%', #{searchtext}, '%') OR merchantid LIKE CONCAT('%', #{searchtext}, '%') OR star LIKE CONCAT('%', #{searchtext}, '%') OR evaluate LIKE CONCAT('%', #{searchtext}, '%')")
    ArrayList<evaluate> findMerchantEva(@Param("searchtext") String searchtext);


}
